const Sequelize = require('sequelize')
const db = require('../db.js')
//把case表的字段映射成对象的属性,封装成Case对象
const Case = db.define(
  'Case',
  {
    id: { type: Sequelize.INTEGER, primaryKey: true, allowNull: false, autoIncrement: true },
    //标题
    name: { type: Sequelize.STRING, allowNull: false },
    //概述
    img: { type: Sequelize.STRING, allowNull: false },
    //文章封面
    desc: { type: Sequelize.STRING },
    //文章内容
    content: { type: Sequelize.TEXT },
  },
  {
    //是否支持驼峰命名
    underscored: true,
    //Case对象，对应的数据库表
    tableName: 'case',
  }
)
module.exports = Case
